<template>
    <followList
        type="following"
        :ready="ready"
        :list="followingList">
    </followList>
</template>

<script lang="ts" setup>
import { ref, onMounted, computed, watch } from 'vue'
import { useRoute } from 'vue-router'
import { getFollowings } from '@/apis/user'
import followList from '../follow-list.vue'
import useScroll from '@/hooks/useScroll'
const route = useRoute()

interface RouterParams {
    id: string
    pageValue: string
}

// 路由信息
const routerParams = computed(() => route.params as unknown as RouterParams)
const { id } = routerParams.value

// 首次加载
const ready = ref<boolean>(true)

// 滚动加载
const  { isBottom } = useScroll()
watch(isBottom, (val) => {
    console.log(val)
})


// 获取关注列表
let followingList = ref([])
const getFollowingsRes = async () => {
    const res = await getFollowings(id)        
    if(res.code === 200) {
        return res.list
    }
}

onMounted(async () => {
    followingList.value = await getFollowingsRes()
    ready.value = false
})

</script>

<style>
</style>